import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, FormArray, FormBuilder, Validators, AbstractControl, NgForm } from '@angular/forms';
import { MobileValidatorDirective } from  '../directives/mobile-validator.directive';
import { EqualValidatorDirective } from  '../directives/equal-validator.directive';

@Component({
  selector: 'app-template-form',
  templateUrl: './template-form.component.html',
  styleUrls: ['./template-form.component.css']
})
export class TemplateFormComponent implements OnInit {

  constructor() { }

  ngOnInit() {
  }

  onSubmit(value, valid) {
    console.log(value);
    console.log(valid);
  }

  mobileValid: boolean = true;
  mobileUntouched: boolean = true;

  onMobileInput(form: NgForm) {
    console.log(form.form.get("username").value)
    if (form.form.get("username").value !== '') {
      this.mobileValid = form.form.get("username").valid;
      this.mobileUntouched = form.form.get("username").untouched;
      console.log(this.mobileValid, this.mobileUntouched);
    }
  }

}
